
<%@ page import="pharmacy.Drug" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'drug.label', default: 'Drug')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${drugInstance}">
            <div class="errors">
                <g:renderErrors bean="${drugInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${drugInstance?.id}" />
                <g:hiddenField name="version" value="${drugInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="id_Official"><g:message code="drug.id_Official.label" default="Id Official" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: drugInstance, field: 'id_Official', 'errors')}">
                                    <g:textField name="id_Official" value="${drugInstance?.id_Official}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="quantityInPrescription"><g:message code="drug.quantityInPrescription.label" default="Quantity In Prescription" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: drugInstance, field: 'quantityInPrescription', 'errors')}">
                                    
<ul>
<g:each in="${drugInstance?.quantityInPrescription?}" var="q">
    <li><g:link controller="quantityAndUse" action="show" id="${q.id}">${q?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="quantityAndUse" action="create" params="['drug.id': drugInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'quantityAndUse.label', default: 'QuantityAndUse')])}</g:link>

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="category"><g:message code="drug.category.label" default="Category" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: drugInstance, field: 'category', 'errors')}">
                                    <g:select name="category.id" from="${pharmacy.DrugCategory.list()}" optionKey="id" value="${drugInstance?.category?.id}"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="drugWarehouses"><g:message code="drug.drugWarehouses.label" default="Drug Warehouses" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: drugInstance, field: 'drugWarehouses', 'errors')}">
                                    
<ul>
<g:each in="${drugInstance?.drugWarehouses?}" var="d">
    <li><g:link controller="drugWarehouse" action="show" id="${d.id}">${d?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="drugWarehouse" action="create" params="['drug.id': drugInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'drugWarehouse.label', default: 'DrugWarehouse')])}</g:link>

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="components"><g:message code="drug.components.label" default="Components" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: drugInstance, field: 'components', 'errors')}">
                                    
<ul>
<g:each in="${drugInstance?.components?}" var="c">
    <li><g:link controller="drugComponent" action="show" id="${c.id}">${c?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="drugComponent" action="create" params="['drug.id': drugInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'drugComponent.label', default: 'DrugComponent')])}</g:link>

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="sellingDetails"><g:message code="drug.sellingDetails.label" default="Selling Details" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: drugInstance, field: 'sellingDetails', 'errors')}">
                                    
<ul>
<g:each in="${drugInstance?.sellingDetails?}" var="s">
    <li><g:link controller="sellingDetail" action="show" id="${s.id}">${s?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="sellingDetail" action="create" params="['drug.id': drugInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'sellingDetail.label', default: 'SellingDetail')])}</g:link>

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="comments"><g:message code="drug.comments.label" default="Comments" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: drugInstance, field: 'comments', 'errors')}">
                                    
<ul>
<g:each in="${drugInstance?.comments?}" var="c">
    <li><g:link controller="drugComment" action="show" id="${c.id}">${c?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="drugComment" action="create" params="['drug.id': drugInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'drugComment.label', default: 'DrugComment')])}</g:link>

                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
